package com.oocl.homework.format.loader;

import com.oocl.homework.exception.VerifyException;
import com.oocl.homework.format.data.DataCustomerImpl;
import com.oocl.homework.format.moel.Customer;
import com.oocl.homework.format.moel.CustomerFactory;
import com.oocl.homework.verify.MyVerify;

public class DataLoaderImpl implements DataLoader {
	
	
	
	public DataLoaderImpl() {
	}

	public String load(String str) {
	
			Customer c =null;
			try {
				c = CustomerFactory.getInstanceWithVerify(str, new MyVerify());
				if (c==null) {
					return "insert fail";
				}
				DataCustomerImpl.getInstance().add(c);
				return "insert success";
			} catch (VerifyException e) {
				//log here
				e.printStackTrace();
			}
			
			return "insert fail";
		
		
	}


	

	
	

}
